home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\SCRIPT\NETSPLIT < prev    next >
Text File  |  1994-12-28  |  4KB  |  167 lines

  1. # NETSPLIT 7 - This script does it's best to suppress the excessive 
  2. # joins and signoffs due ONLY to netsplits.  It should pass regular
  3. # signoffs.   Need at least ircII2.2pre6
  4. # Version II  handles multiple channels. 
  5. # Version III ignores bogus signoff messages
  6. # Version IV  handles multiple splits.
  7. # Version V   handles multiple splits and ignores bogus signoff messages. also
  8. #             adds timestamps to split/join messages
  9. # Version VI  For ircII2.2pre8 and beyond. Uses encode() and decode() 
  10. # Version VII Fixed a problem with encode() and decode() and case
  11. #             sensitive channel names, + adding lformat()
  12. #
  13. # This one by Daemon
  14. # CONVERTED for ircII2.2pre8
  15. # Version V by poxaV (cgw@unt.edu), from Daemon's code
  16. # modified last 7-03-93
  17.  
  18. #shows the current time in HH:MM:SS format
  19. ^alias currtime @ function_return = word(3 $stime($time()))
  20.  
  21. # This function tests for bogus splits.
  22. ^alias isbogus {
  23.     ^if ([$3]) { @ function_return = 1 }
  24.     ^if (rmatch(.$1. $isbogus.pats *..*)) { @ function_return = 1 }
  25.     ^if (rmatch(.$2. $isbogus.pats *..*)) { @ function_return = 1 }
  26. }
  27.  
  28. # Add patterns.. like /boguspat *bonk* *thud* *haha*
  29. # that will NOT be treated as server names..
  30. ^alias boguspat ^assign isbogus.pats $isbogus.pats $0-;echo $0- added
  31.  
  32. # Next two are pretty obvious
  33. ^alias boguslist echo Pats: $isbogus.pats
  34. ^alias bogusclear ^assign -isbogus.pats;echo Bogus list clean
  35.  
  36. # If first word in Signoff contains a period then assume servername
  37. # and thus a a split.  Stash in assoc array.
  38. ^ON ^CHANNEL_SIGNOFF "% % %.% %.%" {
  39.     if (isbogus($1-)) 
  40.         { echo *** Signoff: $1 \($2-\) }
  41.         { ^netbroke $encode($tolower($0)) $encode($1) $encode($2).$encode($3) $2 $3 }
  42. }
  43.  
  44. # Stuff array. Tell us what server broke and set split flag.
  45. ^alias netbroke {
  46.   @ signcross[$2][$0][$1] = 1
  47.   @ signoffs[$0][$1] = [$2]
  48.   @ splittime[$2] = time()
  49.   ^if ( isbroke[$2] )
  50.   {
  51.   }
  52.   {
  53.     xecho -level OPNOTES *** Netsplit at $currtime() \($3-\)
  54.     @ isbroke[$2] = 1
  55.     @ splitname[$2] = [$3-]
  56.   }
  57. }
  58.  
  59. # When a person joins a channel.. Check them against the array.
  60. # If they are in array, then remove silently.  Otherwards echo normally
  61. ^ON ^JOIN * {
  62.   ^netjoined $encode($tolower($1)) $encode($0) $1 $0 $USERHOST()
  63. }
  64.  
  65. # Unset the split flag
  66. ^alias netjoined {
  67.   if ( signoffs[$0][$1] )
  68.   {
  69.     ^if ( isbroke[$signoffs[$0][$1]] )
  70.     {
  71.       xecho -level OPNOTES *** Netjoined at $currtime() \($splitname[$signoffs[$0][$1]]\)
  72.     }
  73.     ^assign -isbroke[$signoffs[$0][$1]]
  74.     ^assign -signcross[$signoffs[$0][$1]][$0][$1]
  75.     ^assign -signoffs[$0][$1]
  76.   }
  77.   {
  78.     echo *** $3 \($4-\) has joined channel $2
  79.   }
  80. }
  81.  
  82. # Clear the array every 10 minutes to prevent excess garbage
  83. ^on #^timer 70 * netclean
  84. ^alias netclean {
  85.   foreach splittime ii
  86.   {
  87.     foreach splittime.$ii jj
  88.     {
  89.       if ( time() - splittime[$ii][$jj] > 300 )
  90.       {
  91.           foreach signcross.$(ii).$jj xx
  92.           {
  93.           foreach signcross.$(ii).$(jj).$xx yy
  94.           {
  95.             ^assign -signcross[$ii][$jj][$xx][$yy]
  96.             ^assign -signoffs[$xx][$yy]
  97.           }
  98.           }
  99.     ^assign -xx
  100.     ^assign -yy
  101.            ^assign -isbroke[$ii][$jj]
  102.     ^assign -splitname[$ii][$jj]
  103.            ^assign -splittime[$ii][$jj]
  104.       }
  105.     }
  106.   }
  107.   ^assign -ii
  108.   ^assign -jj
  109. }
  110.  
  111. ^alias netpurge {
  112.   purge isbroke
  113.   purge splitname
  114.   purge splittime
  115.   purge signcross
  116.   purge signoffs
  117. }
  118.  
  119. # If you want to supress mode changes by servers.. (ussually after a split)
  120. # then uncomment next line
  121. # ^on ^mode "%.%" #
  122.  
  123. # If you want to look an array.. Type /show <arrayname>
  124. # Lists keys and contents
  125. ^alias showsplit {
  126.   if ( [$($0)] )
  127.   {
  128.     echo $0 $($0)
  129.   }
  130.   foreach $0 ii
  131.   {
  132.     showsplit $0.$ii
  133.   }
  134.   ^assign -ii
  135. }
  136.  
  137. ^alias purge {
  138.   foreach $0 ii
  139.   {
  140.     purge $0.$ii
  141.   }
  142.   ^assign -ii
  143.   ^assign -$0
  144. }
  145.  
  146. ^alias wholeft {
  147.   foreach signoffs ii
  148.   {
  149.     foreach signoffs.$ii jj
  150.     {
  151.       echo $lformat(15 $decode($ii)) $lformat(10 $decode($jj)) $splitname[$signoffs[$ii][$jj]]
  152.     }
  153.   }
  154.   ^assign -ii
  155.   ^assign -jj
  156. }
  157.  
  158. # format and lformat differ from $[-num]var and $[num]var in that
  159. # They don't chop off the string if it is too long.
  160.  
  161. alias lformat {
  162.     @ IRCII.word = [$1-]
  163.     if (@IRCII.word < [$0]) 
  164.         { @ function_return = [$([$0]IRCII.word)] } 
  165.         { @ function_return = [$IRCII.word] } 
  166. }
  167.